<!DOCTYPE html>
<html>
<head>
<title>添加故障信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport"
			content="width=device-width,initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<meta name="format-detection" content="telephone=no" />
		<meta name="format-detection" content="email=no" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<!--删除默认的苹果工具栏和菜单栏。-->
		<link rel="stylesheet" href="plug-in/ydui/css/ydui.css?rev=@@hash"/>
		<link rel="stylesheet" href="plug-in/ydui/css/demo.css"/>
		<link rel="stylesheet" href="plug-in/Validform/css/style.css"/>
		<script src="plug-in/ydui/js/ydui.flexible.js"></script>
		<style type="text/css">
			.demo-pagetitle{
				position:relative;
				top:10%;
			}
	    	.m-grids-4{
	    		top:20%;
	    		background:transparent;
	    	}
	    	
			.m-grids-4 .grids-item {
				width: 50%;
			}
			.demo-icons [class^="icon-"]:before, .demo-icons [class*=" icon-"]:before { font-size: 0.6rem; color: #FF685D; }
    	</style>
		<link rel="stylesheet" href="webpage/css/login-main.css" />
		<link rel="stylesheet" href="webpage/css/faultfeedback.min.css" />
		<script type="text/javascript">
		</script>
</head>
<body>
	<!-- <div class="div"></div> -->
	<section class="g-flexview">
		<form id="form" name="form" class="registerform" method="post">
		<header class="m-navbar">
        	<a class="navbar-item" onclick="window.history.go(-1)"><i class="back-ico"></i></a>
        	<div class="navbar-center"><span class="navbar-title">添加故障信息</span></div>
        	<input id="js_submit" class="navbar-right" type="submit" value="提交" />
    	</header>
	    <section class="g-scrollview">
	        <div class="m-cell demo-small-pitch">
	        	<div class="cell-item" style="display:none">
	                <div class="cell-left">id:</div>
	                <div class="cell-right"><input id="id" name="id" type="text" class="cell-input" placeholder="请输入故障编码" autocomplete="off" /></div>
	            </div>
	            <div class="cell-item">
	                <div class="cell-left">故障编码：</div>
	                <div class="cell-right"><input id="dicMelCode" name="dicMelCode" type="text" class="cell-input" placeholder="请输入故障编码" autocomplete="off" /></div>
	            </div>
	            <div class="cell-item">
	                <div class="cell-left">故障名称：</div>
	                <div class="cell-right"><input id="dicMelName" name="dicMelName" type="text" class="cell-input" placeholder="请输入故障名称" autocomplete="off" /></div>
	            </div>
	            <div class="m-cell">
					<label class="cell-item">
						<span class="cell-left">是否激活：</span>
						<label class="cell-right">
							<input id="dicStatus" name="dicStatus" type="checkbox" class="m-switch"/>
						</label>
					</label>
				</div>
			</div>
		</section>
		</form>
	</section>
</body>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="plug-in/ydui/js/ydui.js"></script>
<script src="http://malsup.github.io/jquery.form.js"></script>
<script type="text/javascript" src="plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js"></script>
<script type="text/javascript" src="plug-in/Validform/js/initValidform.js"></script>
<script type="text/javascript">
	$('#js_submit').on('click', function(){
		if(!StopSubmit()){
			return false;
		}
		var check=confirm("您确定要提交表单吗？");
		if(!check){
			return false;
		}
		var dicMelStatus = $("#dicStatus") ;
		if($("#dicStatus").is(":checked")){
		    dicMelStatus .attr("value" ,1);
		}else{
			dicMelStatus .attr("value", 0);
		}
		$('#form').on('submit', function(){
			$.ajax({
				type: 'post', // 提交方式 get/post
				async:false,
		   		url: "systemController.do?doAddMelfunction", // 需要提交的 url
		  		data:$('form').serialize(),
		   		dataType:"json",
		       	success: function(json){ // data 保存提交后返回的数据，一般为 json 数据
		       		if(json.success){
		       			alert("添加成功");
		        		window.location.href="systemController.do?toMelfunction";
		        		return false;
		       		}
		       	},
		       	error:function(){
		       		alert("您的网络可能出现问题，请重试！");
		       		return false;
		       	}
			})
			return false;
		})
	})
</script>
</html>